package com.iemes.controller.pretest.datastatistics;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.iemes.controller.index.BaseController;
import com.iemes.entity.PretesQualityRecordsFormMap;
import com.iemes.entity.PretestDentsityFormMap;
import com.iemes.entity.PretestHooperFormMap;
import com.iemes.mapper.pretest.PreQualityRecordsMapper;
import com.iemes.mapper.pretest.PretesDentsityMapper;
import com.iemes.mapper.pretest.PretesHooperMapper;
import com.iemes.plugin.PageView;
import com.iemes.util.Common;
//预发生产过程质量记录

@RequestMapping("/quality")
@Controller
public class PreQualityRecordsController extends BaseController{

//  密度
	@Inject
	private PretesDentsityMapper pretestDentsityMapper;
	
//  斗
	@Inject
	private PretesHooperMapper pretesHooperMapper;	

	@Inject
	private PreQualityRecordsMapper  prequalitymapper;
	
	@RequestMapping("quality")
	public String dailyproduction(Model model){
		model.addAttribute("res", findByRes());
		model.addAttribute("dentsity", pretestDentsityMapper.findByWhere(getFormMap(PretestDentsityFormMap.class)));
		model.addAttribute("hooper", pretesHooperMapper.findByWhere(getFormMap(PretestHooperFormMap.class)));
		return Common.BACKGROUND_PATH + "/pretest/datastatistics/prequality_list";
	}
	
	@ResponseBody
	@RequestMapping("quality_findByPage")
	public PageView findByPage(String pageNow, String pageSize) throws Exception
	{
		PretesQualityRecordsFormMap qualityFormMap = getFormMap(PretesQualityRecordsFormMap.class);
		List<Map<String, Object>> pretest = prequalitymapper.getAll(qualityFormMap);
		LuogicPaging(pageNow, pageSize, pretest);
		pageView.setRecords(pretest);
		return pageView;
	}
	

}
